package com.ihr360.job.core;

import com.ihr360.job.core.scope.context.SimpleStepContext;

/**
 * Listener interface around the reading of an item.
 *
 * @author Lucas Ward
 *
 */
public interface ItemReadListener<T> extends StepListener {

    /**
     * Called before {@link ItemReader#read()}
     */
    void beforeRead(SimpleStepContext simpleStepContext);

    /**
     * Called after {@link ItemReader#read()}
     *
     * @param item returned from read()
     */
    void afterRead(T item);

    /**
     * Called if an error occurs while trying to read.
     *
     * @param ex thrown from {@link ItemWriter}
     */
    void onReadError(SimpleStepContext simpleStepContext,Exception ex);
}